package com.liruo.srpingframework.dataaccess.transaction.customize;

import org.springframework.boot.autoconfigure.transaction.PlatformTransactionManagerCustomizer;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.support.JdbcTransactionManager;

@Profile("self-transaction-config")
@Import(ProxyAnnotationTransactionAttributeSourceBeanProcessorImportBeanDefinitionRegistrar.class)
//@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class TransactionConfiguration {
  public PlatformTransactionManagerCustomizer<JdbcTransactionManager> platformTransactionManagerCustomizer() {
    return tm -> {
      //ALWAYS ACTUAL_TRANSACTION NEVER
//      tm.setTransactionSynchronization(AbstractPlatformTransactionManager.SYNCHRONIZATION_ALWAYS);
    };
  }
}
